<%@page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@taglib uri="http://www.bird.com" prefix="bird"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:wb=“http://open.weibo.com/wb”>
	<bird:login></bird:login>
	<head>

		<title>Talk with 小黄鸡</title>
		<link rel="stylesheet" href="/Rookie/css/main.css" type="text/css"></link>
		<script
			src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=4067001530"
			type="text/javascript" charset="utf-8">
</script>

		<script type="text/javascript" src="/Rookie/js/jquery-1.7.2.min.js">
</script>
		<script type="text/javascript" src="/Rookie/js/jquery-impromptu.js">
</script>
		<link rel="stylesheet" href="/Rookie/css/jquery-impromptu.css"
			type="text/css"></link>
		<script type="text/javascript">
var allComment = "";
var longweibo = "小黄鸡: Hi~!!!<br/>";
var weiboTitle = "";
var status = 0;

$(document)
		.ready(function() {

			/*设置各种宽高FUCK IE6*/
			var width = $(window).width();//浏览器可视区域宽
				var height = $(window).height();//浏览器可视区域高

				$(".mainDiv").css("width", width * 0.5);
				$(".mainDiv").css("height", height);

				var userAgent = navigator.userAgent.toLowerCase();
				var browserId = userAgent
						.match(/(firefox|chrome|safari|opera|msie)/)[1];
				var browserVersion = (userAgent.match(new RegExp(
						'.+(?:version)[\/: ]([\\d.]+)'))
						|| userAgent.match(new RegExp(
								'(?:' + browserId + ')[\/: ]([\\d.]+)')) || [
						0, '0' ])[1];
				var isIe7 = (browserId + browserVersion == "msie7.0");
				if (isIe7 == true) {
					$(".mainDiv").css("height", height * 1.2);
				}

				$(".send").mouseenter(
						function() {
							$(".send").css("background-image",
									"url('/Rookie/images/but2.jpg')");
						});

				$(".send").mouseleave(
						function() {
							$(".send").css("background-image",
									"url('/Rookie/images/but1.jpg')");
						});

				$("#userinput").keydown(function(event) {
					if (event.keyCode == 13) {
						sendGet();
					}
				})

				$(window).resize(function() {
					width = $(window).width();//浏览器可视区域宽
						height = $(window).height();//浏览器可视区域高
						// 	 alert(height);
						$(".mainDiv").css("width", width * 0.5);
						$(".mainDiv").css("height", height);

					});

			});

function sendGet() {
	var content = $("#userinput").val();
	if (content == "") {
		$.prompt("请不要重复提交！！！", {
			title : "message box",
			buttons : {
				"知道啦!!" : true
			}
		});
		return;
	}

	if (status == 1) {
		$.prompt("请淡定一些嘛，等等小黄鸡，她很快就回复你啦！！！", {
			title : "message box",
			buttons : {
				"知道啦!!" : true
			}
		});
		return;
	}

	longweibo = longweibo + "我: " + content + "<br/>";

	$("#userinput").val("");
	var url = "/Rookie/servlet/AjaxServlet?key=" + content;

	var source = $(".dialog").html();
	source = source + "<p class='dialog_person'>" + content
			+ "&nbsp;&nbsp;&nbsp;"
			+ "<img src='/Rookie/images/person.jpg'/></p>";
	source = source + "<hr size='0.1px' color='black;'/>";
	allComment = source;

	url = encodeURI(encodeURI(url));
	$.get(url, callback);

	status = 1;//表示已经发送了一个请求等待回复

	source = source
			+ "<p class='dialog_p'><img src='/Rookie/images/chiken.jpg'/>&nbsp;&nbsp;&nbsp;<img src='/Rookie/images/loading.gif'/></p>";
	source = source + "<hr size='0.1px' color='black;'/>";
	$(".dialog").html(source);
	var objDiv = document.getElementById("dialogID");
	objDiv.scrollTop = objDiv.scrollHeight;
}

function callback(data) {
	longweibo = longweibo + "小黄鸡: " + data + "<br/>";

	allComment = allComment
			+ "<p class='dialog_p'><img src='/Rookie/images/chiken.jpg'/>&nbsp;&nbsp;&nbsp;"
			+ data + "</p>";
	allComment = allComment + "<hr size='0.1px' color='black;'/>";
	$(".dialog").html(allComment);
	var objDiv = document.getElementById("dialogID");
	objDiv.scrollTop = objDiv.scrollHeight;

	status = 0;//已经得到了小黄鸡的回复
	//alert(data);
}

function sendLongWeibo() {
	//alert(longweibo);
	/*  	    var url ="/Rookie/servlet/CreatePic";
	  	    var data = longweibo;
	  	    data = "key="+data;
	  	    data = encodeURI(encodeURI(data));  
	  	    $.post(url,data,postcallback);*/

	var statesdemo = {
		state0 : {
			title : '发送长微博（长微博图片会后台自动生成）',
			html : '<label>请输入微博的文字标题  <textarea class="st" rows="5" cols="30">#小黄鸡微博版# 这是我调戏小黄鸡的成果，@bird1992  大家快来看看吧</textarea></label><br />',
			buttons : {
				Send : 1
			},
			focus : 1,
			submit : function(e, v, m, f) {
				weiboTitle = $(".st").val();
				afterLongWeibo(weiboTitle);
			}
		}
	};

	$.prompt(statesdemo);
}

function afterLongWeibo(mydata) {
	if (mydata == "")
		mydata = "#小黄鸡微博版# 这是我调戏小黄鸡的成果，@bird1992  大家快来看看吧";
	var url = "/Rookie/servlet/CreatePic";
	var data = longweibo;
	data = "key=" + data + "&" + "data=" + mydata;
	data = encodeURI(encodeURI(data));
	$.post(url, data, postcallback);
}

function postcallback(data) {

	$.prompt(data, {
		title : "message box",
		buttons : {
			"知道啦!!" : true
		}
	});
}
</script>


	</head>
	<body
		style="background: url('/Rookie/images/bg.png') repeat fixed center top; background-color: #e5e5d7;">

		<!-- 主框 -->
		<div class="mainDiv">
			<!-- logo -->
			<div style="padding-left: 1%; padding-top: 2%;" class="logogDIV">
				<p style="float: left;">
					<img src="/Rookie/images/logo.png" />
				</p>
				<p class="logo">
					<font>1.及时和小黄鸡进行一对一对话,再也不用发微博@小黄鸡然后凭借人品苦苦等待啦！！！</font>
				</p>
				<p class="logo">
					<font>2.发送长微博及时共享调戏小黄鸡成果到微博，再也没有频率限制啦！！</font>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					
				</p>
				<p class="logo">
					<font>3.您还有什么好的建议请赶快@我呦，我会尽快更新的！！！</font>
				</p>
				<p class="logo">
				
					<font>4.官方微博:<wb:follow-button
							uid="1921659541" type="red_3" height="24"></wb:follow-button> </font>
				</p>


			</div>

			<!-- 介绍框 -->
			<div class="description">
				<wb:livestream skin="silver" appkey="4067001530"
					topic="%E5%B0%8F%E9%BB%84%E9%B8%A1%E5%BE%AE%E5%8D%9A%E7%89%88|%E5%B0%8F%E9%BB%84%E9%B8%A1%E5%BE%AE%E5%8D%9A%E7%89%88"
					width="auto" height="${height}"></wb:livestream>
			</div>

			<!-- 聊天框 -->
			<div class="dialog" id="dialogID">
				<p class="dialog_p">
					<img src="/Rookie/images/chiken.jpg" />
					&nbsp;&nbsp;&nbsp;Hi~~!!!
				</p>
				<hr size="0.1px" color="black;" />

			</div>
			<span id="wb_publisher"></span>


			<!-- 提示框 -->
			<div class="wordDIV">
				<font id="word">you should type word here</font>
			</div>
			<br />

			<!-- 输入框 -->
			<div class="chatBox">
				<input type="text" id="userinput" class="userinput" />
				<input onclick="sendGet();" type="button" value="Send" class="send" />

				<!-- 长微博 -->
				<div class="longweibo">
				<input onclick="sendLongWeibo();" class="weiboBut" type="button"
						value="" />
					<font style="float: left;padding-left: 20px;padding-right: 5px;">
						<a style="background-color: white; border: 0px;"
						href="javascript:void((function(s,d,e,r,l,p,t,z,c){var%20f='http://v.t.sina.com.cn/share/share.php?appkey=4067001530',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','http://www.chenxianlu.cn/Rookie/images/chiken.jpg','还在凭借人品苦苦@ 等待小黄鸡的回复吗？快来小黄鸡微博版及时快速调戏小黄鸡吧，更可以发送长微博同步调戏小黄鸡成果哦，@bird1992 一切尽在','http://www.chenxianlu.cn','gb2312'));"><img
								src="/Rookie/images/publish_button_32.gif" />
					</a> </font>
					
				</div>

			</div>


		</div>

		<!-- footer 

	<div class="footer">@bird1992   本程序由bird1992开发，详情请@我</div>
	-->
	</body>
</html>
